package com.roadjava.tutor.bean.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * 栏目类型
 * @author zhaodaowen
 * @see <a href="http://www.roadjava.com">乐之者java</a>
 */
public enum RoleEnum {
    STUDENT("student","学生"),
    ADMIN("admin","管理员"),
    TEACHER("teacher","教师");

    private String enName;
    private String cnName;

    RoleEnum(String enName,String cnName) {
        this.enName = enName;
        this.cnName = cnName;
    }

    public static RoleEnum getByEnName(String enName) {
        if (StringUtils.isBlank(enName)) {
            return null;
        }
        for (RoleEnum e : values()) {
            if (enName.equals(e.getEnName())) {
                return e;
            }
        }
        return null;
    }

    public String getEnName() {
        return enName;
    }

    public String getCnName() {
        return cnName;
    }
}
